package com.example.mes_common.utils;

import com.example.mes_common.enums.ResultCode;
import com.example.mes_common.result.JsonResult;

/**
 * 统一返回体构建工具
 */
public class ResultTool {
    public static JsonResult success() {
        return new JsonResult(true);
    }

    public static <T> JsonResult<T> success(T data) {
        return new JsonResult(true, data);
    }

    public static JsonResult fail() {
        return new JsonResult(false);
    }

    public static JsonResult fail(ResultCode resultEnum) {
        return new JsonResult(false, resultEnum);
    }

    public static JsonResult fail(int code, String msg) {
        return new JsonResult(false, code, msg);
    }

}

